<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redis;

class DemoController extends Controller
{
    public function searach(Request $request){
        $key = $request ->input('key');
        $score = Redis::zscore('list',$key);
       if (!$score){
           Redis::zadd('list',1,$key);
       }else{
           Redis::zincrby('list',1,$key);
       }
       $data = Redis::zrevrange('list',0,-1);
       return $data;
    }

}
